home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3968 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: transfer.stratus.com!usenet
  2. From: "David L. McReynolds" <David_McReynolds@vos.stratus.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Question on argv
  5. Date: 1 Feb 1996 05:56:40 GMT
  6. Organization: S2 Systems, Inc.
  7. Message-ID: <4epkmo$231@transfer.stratus.com>
  8. References: <4eoq3c$45j@usenet.ucs.indiana.edu>
  9. NNTP-Posting-Host: enclave.ssi.stratus.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
  14.  
  15. gompa@nickel.ucs.indiana.edu (Raghu R. Gompa) wrote:
  16. >I am writing a program in which I want to
  17. >retrieve the arguments argv[1] ... argv[4].
  18. >argv[1] .. argv[3] are strings of characters.
  19. >I want to use argv[4] as an integer.  Can
  20. >I do that?  and how?   Thank you for your
  21. >help in advance. .. Raghu
  22.  
  23.  
  24. -- 
  25. argv is an array of pointers to arrays of chars. Therefore
  26. you will have to do something like
  27.  
  28. int my_int_argv4;
  29.  
  30. my_int_argv4 = atoi(argv[4]);
  31.  
  32. the prototype for atoi is: int atoi(const char*);
  33. ______________________________________________________________________________
  34. David L. McReynolds                          All statements are my own and
  35. Software Engineer I                          are in no way reflective of
  36. S2 Systems, Inc.                             the ideas or attitudes of
  37. 600 Embassy Row, Suite 300                   S2 Systems, Inc.
  38. Atlanta, GA   30328-1670  USA
  39. email: David_McReynolds@vos.stratus.com
  40. fax: (770)551-2550
  41.  
  42.  
  43.